<?php



// 本类由系统自动生成，仅供测试用途
class IndexAction extends CommonAction{
	
	
    public function index(){
    	
    	$book_dao = new BookModel();
    	$newest_books = $book_dao->getNewestBooks(10);
    	$group_dao = new GroupModel();
    	$newest_groups = $group_dao->getNewestGroups(10);
    	$this->assign("newest_books", $newest_books);
    	$this->assign("newest_groups", $newest_groups);
    	$this->display();
    }
    
    public function admin() {
    	$this->checkAdmin();
    	$user_dao = new UserModel();
    	if(isset($_GET['name'])) {
    		$users = $user_dao->getUsersLikeName($_GET['name']);
    		$this->assign("users", $users);
    	}
    	else {
    		$result = $user_dao->getAllByPage(20);
    		$this->assign("users", $result['data']);
    		$this->assign("page", $result['page']);
    	}
    	$this->display();
    }
    
}
?>